<html class="x-admin-sm">
<head>
      <meta charset="UTF-8">
      <title>包裹管理</title>
      <meta name="renderer" content="webkit">
      <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
      <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
      <link rel="stylesheet" href="css/font.css">
      <link rel="stylesheet" href="css/xadmin.css">
      <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
      <script type="text/javascript" src="lib/layui/layui.js" charset="utf-8"></script>
      <script type="text/javascript" src="js/xadmin.js"></script>
      <script type="text/javascript" src="js/cookie.js"></script>
</head>
<script>
    $(function(){
        $("#submit").click(function () {
            var str="http://localhost:8080/package/get_package_list/"+$("#select").val()+"/"+$("#selectway").val()+"/"+$("#input").val();
            $.ajax({
                url:str,
                type:"GET",
                dataType:'JSON',
                contentType : "application/json; charset=utf-8",
                success:function(data){
                    var obj = data;
                    if(obj.code.code === 0){
                        var tableData;
                        var list=obj.packageList;
                        $("#numspan").text("显示数据："+list.length+"条");
                        for(var i=0;i<list.length;i++){

                            var str="<td class='td-manage'>"+
                                '<a title="编辑"  href="javascript:;"  onclick="x_admin_show( \'编辑\',\'package-edit.html?Data='+list[i].id+'\',600,400)">'+
                                "<i class=\"layui-icon\">&#xe642;</i>" +
                                "</a>" +
                                "</td>";

                            tableData+="<tr> " +
                                "<td>"+list[i].id +"</td> " +
                                "<td>"+list[i].sourceNode +"</td> " +
                                "<td>"+list[i].targetNode +"</td>" +
                                "<td>"+list[i].createTime +"</td>" +
                                "<td>"+list[i].status +" </td>"+str+
                                "</tr>";
                        }
                        $("#firsttbody").html(tableData);
                    }
                    else if(obj.code.code === 2){
                        layer.msg(obj.code.message);
                    }
                },
                error:function(){
                    layer.msg("error",{time:1000});
                }
            });
        });
    });
</script>
<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="">包裹列表</a>
        </span>
        <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
            <i class="layui-icon" style="line-height:30px">刷新</i>
        </a>
    </div>
    <div class="x-body">

        <div class="layui-row">
            <form class="layui-form layui-col-md12 x-so" method="#">
                <div class="layui-input-inline" style="margin-left: 380px">
                    <select id="select">
                        <option value="ID">包裹编号</option>
                        <option value="SourceNode">源节点</option>
                        <option value="TargetNode">目的节点</option>
                        <option value="CreateTime">创建时间</option>
                        <option value="Status">状态</option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select id="selectway">
                        <option value="eq">等值查找</option>
                        <option value="like">模糊查找</option>
                    </select>
                </div>
                <input id="input" class="layui-input" type="text" name="customername" placeholder="请输入属性值" autocomplete="off" value="">
                <button class="layui-btn" id="submit" type="button"><i class="layui-icon">&#xe615;</i></button>
            </form>
        </div>
        <xblock>
            <!--<button class="layui-btn" onclick="x_admin_show('添加包裹','./package-add.html',400,350)"><i class="layui-icon"></i>添加</button>-->
            <span class="x-right" id="numspan" style="line-height:40px">显示数据：0条</span>
        </xblock>
        <table class="layui-table x-admin">
            <thead>
                <tr>
                    <th>包裹编号</th>
                    <th>源节点</th>
                    <th>目的节点</th>
                    <th>创建时间</th>
                    <th>状态</th>
                    <th>编辑</th>
                </tr>
            </thead>
            <tbody id="firsttbody">

            </tbody>
        </table>
        <!--<div class="page">-->
            <!--<div>-->
                <!--<a class="prev" href="">&lt;&lt;</a>-->
                <!--<a class="num" href="">1</a>-->
                <!--<a class="next" href="">&gt;&gt;</a>-->
           <!--</div>-->
        <!--</div>-->
    </div>
<script>
    /*用户-删除*/
    // function employee_del(obj,uId){
    //     layer.confirm('确认要删除吗？',function(index){
    //         //发异步删除数据
    //         var str="http://localhost:8080/user/deleteUserInfo/"+uId;
    //         $.ajax({
    //             url:str,
    //             type:"GET",
    //             dataType:'JSON',
    //             contentType : "application/json; charset=utf-8",
    //             success:function(data){
    //                 layer.msg('已删除!',{icon:1,time:1000});
    //             },
    //             error:function(){
    //                 alert("error");
    //             }
    //         });
    //         $(obj).parents("tr").remove();
    //         layer.msg('已删除!',{icon:1,time:1000});
    //     });
    // }
</script>
</body>
</html>